/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"07D8B497-1DE5-4DA1-90CE-702B762D84DF"}
 */
function buscar(event) {
	controller.loadRecords(gproveedorprecio_to_precios_proveedor)
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"A6695EE2-859D-442E-A26A-D05C492DE405"}
 */
function agregar(event) {
	if (globals.gProveedorPrecio != null)
	{
		databaseManager.setAutoSave(false)
		
		var frm 						= forms.precios_proveedor_carga
		frm.controller.newRecord()
		
		frm.proveedor_id 				= globals.gProveedorPrecio
		frm.fecha 						= application.getServerTimeStamp()
		
		frm.elements.proveedor.enabled 	= false
		frm.elements.cod_prov.enabled	= true
		frm.elements.fecha.enabled		= true
		frm.elements.precio.enabled		= true
		frm.elements.producto.enabled	= true
		frm.elements.btn_borrar.visible	= false
		
		globals.formEnVentana('precios_proveedor_carga','CARGA_PRECIO','Carga de Precio')	
	}
	else
		globals.DIALOGS.showWarningDialog('Aviso','Elija un proveedor','OK')
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"8B2B0E0C-ADF2-4F61-ACD3-055EAB8E4EEB"}
 */
function cambiaPrecio(event) {
	databaseManager.setAutoSave(false)

	var frm 						= forms.precios_proveedor_carga

	//frm.producto_id 				= globals.gProductoPrecio
	//frm.proveedor_id 				= proveedor_id
	frm.fecha 						= application.getServerTimeStamp()

	frm.elements.producto.enabled 	= false
	frm.elements.proveedor.enabled	= false
	frm.elements.fecha.enabled		= true
	frm.elements.cod_prov.enabled	= true
	frm.elements.precio.enabled		= true
	frm.elements.btn_borrar.visible	= true

	globals.formEnVentana('precios_proveedor_carga','CARGA_PRECIO','Carga de Precio')
}
